srcdir=src/
objdir=obj/
bindir=bin/
includedir=src/
CXX=g++
CXXFLAGS=-fPIC -Wall -s -O2
LDFLAGS=-lSDL -lGL -lGLU -lglut -lGLEW -lm -lpng12
EXE=mouill
SRC= $(wildcard $(srcdir)*.cpp)
OBJ= $(SRC:%.cpp=$(objdir)%.o)

all: depend $(EXE)

$(EXE): $(OBJ)
	$(CXX) -o $(bindir)$@ $^ $(LDFLAGS) $(CXXFLAGS)
	
depend: 
	$(CXX) -MM $(SRC) >depend

-include depend

$(objdir)%.o: %.cpp
	$(CXX) -o $@ -c $< $(CXXFLAGS) -I$(includedir)

.PHONY: clean mrproper

clean:
	rm -rf $(objdir)*.o
	rm -rf $(objdir)*/*.o

mrproper: clean
	rm -rf $(bindir)$(EXE)
	rm -rf $(includedir)*~
	rm -rf $(srcdir)*~
	rm -rf *~
	
run:
	$(bindir)$(EXE) ressources/mouillere2.mnt ressources/mouillere2.png
